<?php

/*
 * @author Ebrain Cedeno <ebraincedeno@gmail.com>
 */

class TCheckBox extends TWidget{
    
    public $Disabled;
    public $Checked = false;
    public $Value=0;
    
    public function __construct() {
        parent::__construct(__CLASS__);
        $this->Width =20;
        $this->Height=20;
    }
    
    protected function getCheckBox(){
        if ($this->Checked == true){
            return 'checked="checked"';
        }
        else{
            return '';
        }
    }
    
    protected function getDisabled(){
        if ($this->Disabled == true){
            return 'disabled';
        }
        else{
            return '';
        }
        
    }
    
    public function show(){
        
        if (!array_key_exists('style', $this->OptionsAditional)){
            $this->OptionsAditional['style'] = array('width:'.$this->Width.'px','height:'.$this->Height.'px');
        }
        else{
            $this->OptionsAditional['style'][] = 'width:'.$this->Width.'px';
            $this->OptionsAditional['style'][] = 'height:'.$this->Height.'px';
        }
        
        if ($this->Visible == true){
            $html = '<input name="'.$this->Name.'" id="'.$this->Id.'" type="checkbox" value="'.$this->Value.'" '.$this->getOptionsAditional().' '.$this->getCheckBox().' '.$this->getDisabled().' />';
            return $html;
        }
        
    }
    
}
?>
